package cn.ym.aircraft;

import javax.swing.*;
import java.awt.image.BufferedImage;

public class BigAirplane extends FlyingObject implements EnemyLife{
    int speed;

    BigAirplane() {
        super(66, 89);
        this.speed = 2;
    }

    public void step() {
        this.y += this.speed;
    }

    private int index = 1;

    @Override
    public BufferedImage getImage() {
        if (isLive()) {
            return Images.bairs[0];
        } else if (isDead()) {
            BufferedImage img = Images.bairs[index++];
            if (index == Images.bairs.length) {
                this.state = REMOVE;
            }
            return img;
        }
        return null;
    }

    @Override
    public int getLife() {
        return 1;
    }
}
